Skip to content

Show preview when MouseEditMove in cubic_splines example - #26310

Merged
alice-i-cecile merged 2 commits into
bevyengine:mainfrom
U-C-S:cubic-splines-example-update
Oct 26, 2026
Merged

alice-i-cecile merged 2 commits into
bevyengine:mainfrom
U-C-S:cubic-splines-example-update

Conversation

@U-C-S

@U-C-S U-C-S commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Objective

Update the examples/math/cubic_splines.rs to also show a preview of new line segment of the curve. The current example only shows the tangent as you MouseEditMove (aka click and drag the mouse pointer).

Solution

Store the preview point and it's tangent in the ControlPoints struct and draw it as the MouseEditMove changes each frame. So, this includes extra logic in the form_curve fn to also include the preview_point.

Testing

Tested it in Macbook m2 pro, manually by running the example.

The preview line segment moves accordingly for the SplineMode::Hermite as the tangent is only used in this mode.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@U-C-S
U-C-S force-pushed the cubic-splines-example-update branch from 8f0c97d to ee6ca75 Compare October 25, 2026 17:28
@alice-i-cecile alice-i-cecile added C-Examples An addition or correction to our examples C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Math Fundamental domain-agnostic mathematical operations D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 25, 2026

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, this is a nice addition!

@alice-i-cecile alice-i-cecile added the X-Uncontroversial This work is generally agreed upon label Oct 25, 2026
@DaAlbrecht DaAlbrecht added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 26, 2026

@jbuehler23 jbuehler23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, but it would be a good idea for next time to attach a Showcase directly to the PR description!

@alice-i-cecile
alice-i-cecile added this pull request to the merge queue Oct 26, 2026
Merged via the queue into bevyengine:main with commit 920920e Oct 26, 2026
49 checks passed
@U-C-S
U-C-S deleted the cubic-splines-example-update branch October 26, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations C-Examples An addition or correction to our examples C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants